<?php


namespace Modules\User\Http\Controllers\Web;


use App\Http\Controllers\MyController;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Modules\User\Models\User;
use App\Models\UserInfo;
use Modules\User\Models\UserPoint;
use Illuminate\Http\Request;
use Modules\User\Http\Requests\UserInfoRequest;
class FractionController extends MyController
{
    public function index(Request $request)
    {
        session([
            'the_page' => 'Fraction',
            'page_title' => "积分记录",
        ]);
        $aid=$request->get('id');
        $id= auth()->user()->id;
        $list=UserPoint::where('user_id', $id)->where('aid',$aid)->orderBy('id','desc')->get();
        return $this->theme('fraction',['list'=>$list]);
    }
    public function save(UserInfoRequest $request)
    {
        $id= auth()->user()->id;
        $password=$this->request('password');
        $user = User::where('id',)->first();
        if ($user) {
            $user->password = Hash::make($password);
            $result = $user->save();
            return $this->result($result, ['msg' => '修改成功']);
        }
       return $this->result(false, ['msg' => "修改失败"]);
    }
}